package hu.myai.indicators.util;

import hu.myai.api.indicators.AbstractTrend;
import hu.myai.model.TrendLineVO;

/**
 * Provides FibonacciFan levels
 *
 * @author bozbalint
 *
 * */
public class FibonacciFan extends AbstractTrend {

    /**
     * @param fromValue
     *            the 0% level Value of the fibonacci fan
     * @param toValue
     *            the 0% level Timestamp of the fibonacci fan
     * @param toTime
     *            the 100% level Value of the fibonacci fan
     * @param tangens
     *            the 100% level Timestamp of the fibonacci fan
     */
    public FibonacciFan(double fromValue, int fromTime, double toValue, int toTime) {
        super();

        // 0%
        levelList.add(new TrendLineVO(fromValue, fromTime, toValue, toTime));
        // 38.2%
        levelList.add(new TrendLineVO(fromValue, fromTime, (toValue - fromValue) * 0.382 + fromValue, toTime));
        // 50%
        levelList.add(new TrendLineVO(fromValue, fromTime, (toValue - fromValue) * 0.50 + fromValue, toTime));
        // 61.8%
        levelList.add(new TrendLineVO(fromValue, fromTime, (toValue - fromValue) * 0.618 + fromValue, toTime));
        // 100%
        levelList.add(new TrendLineVO(fromValue, fromTime, toValue, toTime));
    }
}
